<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改车辆轨迹信息')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-trail-edit" th:object="${trail}">
            <input name="trailId" th:field="*{trailId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">车牌号码：</label>
                <div class="col-sm-8">
                    <input name="carNum" th:field="*{carNum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">车辆起始位置：</label>
                <div class="col-sm-8">
                    <textarea name="locationStart" class="form-control" required>[[*{locationStart}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">车辆终点位置：</label>
                <div class="col-sm-8">
                    <textarea name="locationEnd" class="form-control" required>[[*{locationEnd}]]</textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">轨迹信息：</label>
                <div class="col-sm-8">
                    <textarea name="trailMassage" class="form-control">[[*{trailMassage}]]</textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">车辆开始时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="trailStart" th:value="${#dates.format(trail.trailStart, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">预计结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="trailYujiEnd" th:value="${#dates.format(trail.trailYujiEnd, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">实际结束时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="trailEnd" th:value="${#dates.format(trail.trailEnd, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">轨迹状态：</label>
                <div class="col-sm-8">
                    <select name="isState" class="form-control m-b" th:with="type=${@dict.getType('is_state')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isState}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "trail/trail";
        $("#form-trail-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-trail-edit').serialize());
            }
        }

        $("input[name='trailStart']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='trailYujiEnd']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='trailEnd']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>